﻿@using System.Data
@using ZoomLa.Common
@model ZoomLa.SQLDAL.SQL.PageSetting
@{ 
    Model.cols = 5;
    Model.Check=false;
    Model.url = "InviteCode";
}
@functions{
    public MvcHtmlString CodeStatus(string str3)
    {
        string result = "";
        switch (str3)
        {
            case "0":
                result = "<span style='color:green;'>未使用</span>";
                break;
            case "99":
                result = "<span style='color:red;'>已使用</span>";
                break;
            default:
                break;
        }
        return MvcHtmlString.Create(result);
    }
    public string GetCreateMode(DataRow dr)
    {
        if (DataConverter.CLng(dr["CAdmin"]) > 0) { return "系统生成"; }
        else return "自生成";
    }
}
<div id="EGV">
    <table class="table table-striped table-bordered table-hover text-center">
        @if (Model.itemCount > 0)
        {
            <tr><th>ID</th><th>邀请码</th><th>状态</th><td>使用人</td><td>生成方式</td><th>日期</th><th>操作</th></tr>
            foreach (DataRow dr in Model.dt.Rows)
            {
                <tr>
                    <td>@dr["ID"]</td>
                    <td>@dr["Code"]</td>
                    <td>@CodeStatus(dr["ZStatus"].ToString())</td>
                    <td>@DataConverter.CStr(dr["UsedUserName"])</td>
                    <td>@GetCreateMode(dr)</td>
                    <td>@DataConverter.CDate(dr["CDate"])</td>
                    <td>
                        <a href="javascript:;" onclick="mvcpage.del({ ids: '@dr["ID"]', url: 'code_del', confirm: '您确定要移除吗?' });"  title="移除"><span class="fa fa-trash-o" style="color:#7D98A1;"></span></a>
                    </td>
                </tr>
            }
            @Html.Partial("_page",Model)
        }
        else
        {
            <tr><td colspan="5">当前没有邀请码!!</td></tr>
        }
    </table>
</div>